<?php
class Article extends AppModel { 
       var $name = 'Article';
       //var $actsAs = array('Tree'=> array('left'=>'left','right'=>'right') );
       //var $hasOne = array('CategoryContent');
       
       var $hasAndBelongsToMany=array(
        'Category' => array(
            'className' => 'Category',
            'joinTable' => 'category_datas',
            'foreignKey' => 'data_id',
            'associationForeignKey' => 'category_id',
            'unique' => true,
            'conditions' => "CategoryData.type='Article'",
            'fields' => '',
            'order' => '',
            'limit' => '',
            'offset' => '',
            'finderQuery' => '',
            'deleteQuery' => '',
            'insertQuery' => '',
        ),
    );
    var $validate = array(
    	'title' => array(
            'rule' => 'notEmpty',
            'message' => 'This field cannot be left blank.',
        ),
        'slug' => array(
        	'notEmpty'=> array(
	            'rule' => 'notEmpty',
	            'message' => 'This field cannot be left blank.',
	        ),
	        'isUnique'=>array(
	            'rule' => 'isUnique',
	            'message' => 'The slug has already been taken.',
	        ),
        ),
    );
    
} 